/**
 * @param {number[][]} matrix
 * @return {void} Do not return anything, modify matrix in-place instead.
 */
var setZeroes = function (matrix) {
    let rSet = new Set();
    let cSet = new Set();
    let r = matrix.length, c = matrix[0].length
    for (let i = 0; i < r; i++) {
        for (let j = 0; j < c; j++) {
            if (matrix[i][j] == 0) {
                rSet.add(i)
                cSet.add(j)
            }
        }
    }
    for (let val of rSet.values()) {
        for (let j = 0; j < c; j++) matrix[val][j] = 0
    }
    for (let val of cSet.values()) {
        for (let i = 0; i < r; i++) matrix[i][val] = 0
    }
    return matrix
};
console.log(setZeroes([[0, 1, 2, 0], [3, 4, 5, 2], [1, 3, 1, 5]]));